import { Injectable } from '@angular/core';
import * as gc from 'src/app/global/const';
import { JsonResult } from 'src/app/global/model';
import { Observable } from 'rxjs';
import { HttpClient } from '@angular/common/http';
import { ContactType } from './contact-type.service';

@Injectable({
  providedIn: 'root'
})
export class ContactCompanyService {

  path_pre = 'contactCompany';

  url = {
    'deleteByPrimaryKey':gc.BACKEND_SERVER_ROOT + '/' + this.path_pre,
    'selectByPrimaryKey':gc.BACKEND_SERVER_ROOT + '/' + this.path_pre,
    'selectAll':gc.BACKEND_SERVER_ROOT + '/' + this.path_pre + '/a',
    'saveOne':gc.BACKEND_SERVER_ROOT + '/' + this.path_pre,
  }
  constructor(
    private http:HttpClient
  ) { }

  deleteByPrimaryKey(sid:string):Observable<JsonResult>{
    const url = this.url.deleteByPrimaryKey + '/' + sid;
    return this.http.delete<JsonResult>(url);
  }

  selectByPrimaryKey(sid:string):Observable<JsonResult>{
    const url = this.url.selectByPrimaryKey + '/' + sid;
    return this.http.get<JsonResult>(url);
  }

  selectAll():Observable<JsonResult>{
    return this.http.get<JsonResult>(this.url.selectAll);
  }

  saveOne(record:ContactCompany):Observable<JsonResult>{
    return this.http.post<JsonResult>(this.url.saveOne,record);
  }


}


// Author：chanchaw
// Generator Version：1.0 - 2019年11月16日 16点46分
// This Model Created：Sun Dec 15 2019 15:51:42 GMT+0800 (中国标准时间)
export class ContactCompany{
  alias:string;
  create_time:Date;
  name:string;
  seq:number;
  sid:string;
  type_name:string;
  type_sid:string;

  typeSidArray:string[] = [];
  typeList:ContactType[] = [];
}

